/**
 * linux终端下的图形界面NEWT库的使用演示
 * @author 张伟
 * @date 2017/1/7
 * @remarks
 * 本代码依赖newt-devel，而newt-devel依赖slang-devel
 */

#include <newt.h>
#include <unistd.h>

int main()
{
	newtComponent form, btn1, btn2;
	newtInit();
	newtCls();
	newtDrawRootText(5, 0, "hello, test newt!");
	newtDrawRootText(2, 15, "another text");

	newtRefresh();

	sleep(1);
	newtDrawRootText(10, 10, "Press Any Key to Open a Window!");
	newtRefresh();
	newtWaitForKey();

	newtCenteredWindow(36, 13, "I am title");
	//newtRefresh();
	btn1 = newtButton(10, 1, "Ok");
	btn2 = newtCompactButton(22, 2, "Cancel");
	form = newtForm(NULL, NULL, 0);
	newtFormAddComponents(form, btn1, btn2, NULL);

	newtRunForm(form);

	newtFormDestroy(form);

	//newtBell();
	//sleep(3);
	newtPopWindow();

	newtFinished();
	return 0;
}

